package lib

import "math/rand"

func IsSorted(data []int) bool {

	for i := 1; i < len(data); i++ {
		if data[i-1] > data[i] {
			return false
		}
	}
	return true
}

func Swap(nums []int, i, j int) {
	nums[i], nums[j] = nums[j], nums[i]
}

func CopySlice(data []int) []int {
	var dup []int
	dup = append(dup, data...)
	return dup
}

// Shuffle TODO error
func Shuffle(data []int) {
	rand.Shuffle(len(data), func(i, j int) {
		data[i], data[j] = data[j], data[i]
	})
}
